#define MAX_BUILTIN_FUNC_NUM (128)
#define MAX_BUILTIN_NAME_LENGTH (128)
#define MAX_BUILTIN_OPT_LENGTH (64)

#define MAX_LONGOPT_NAME_LENGTH (128)
#define MAX_BUILTIN_DESC_LENGTH (1024)

#define MAX_REFS_HEADS_NUMS (10000)

#define SHA_1_MAX_LENGTH (128)


typedef struct obj_index{
	char parent[SHA_1_MAX_LENGTH];
	char tree[SHA_1_MAX_LENGTH];
	char author[MAX_LONGOPT_NAME_LENGTH];
	char committer[MAX_LONGOPT_NAME_LENGTH];
	char file_path[MAX_BUILTIN_NAME_LENGTH];
	char file_sha_path[MAX_BUILTIN_NAME_LENGTH];
	char _tips[MAX_LONGOPT_NAME_LENGTH];
	char file_type[128];
}obj_index;


typedef struct REFS_heads{
	char name[MAX_BUILTIN_NAME_LENGTH];
}REFS_heads;

typedef struct BuiltinCmd {
    char name[MAX_BUILTIN_NAME_LENGTH]; // 命令名称
    char desc[MAX_BUILTIN_DESC_LENGTH]; // 对此命令的描述
    char Help[MAX_BUILTIN_DESC_LENGTH];//help
	char action[MAX_BUILTIN_DESC_LENGTH];
    bool hasAction; // 是否有 action
    int optNum; // 设置的个数
} BuiltinCmd;

int initBuiltin();
int addBuiltinCmd(const BuiltinCmd * cmd);
int findBuiltinCmd(const char * name);

//int add_refs_heads(const REFS_heads * cmd);
//int find_refs_heads(const char * name);

int git_commit();
int git_init();
int git_add();
int git_rm();
int git_diff();
int git_pwd();
int git_log();


int _init();

int git_init_cmdpline(int pos,int retc,char **retv);
int git_pwd_cmdpline();
int git_diff_cmdpline(int pos,int retc,char **retv);
int git_commit_cmdpline(int pos,int retc,char **retv);
int git_rm_cmdpline();
int git_log_cmdpline();


int git_diff_run(int retc,char **retv); 
int git_pwd_run();
int git_init_run(int retc,char **retv);
int git_add_run(int retc,char **retv);
int git_commit_run(int retc,char **retv);
int git_rm_run(int retc,char **retv);
int git_log_run();



int get_sha_path(char *SHA_1);
int findtxt(const char *name,obj_index _index,char *SHA_1,char *obj_sha);
